<html>
<head><meta charset="utf-8"><title>LanesAtMost32 · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html">LanesAtMost32</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="235428910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235428910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235428910">(Apr 20 2021 at 22:58)</a>:</h4>
<p>Should we consider the possibility that this trait isn't temporary?  Even if we lift some of the restrictions there will still be a limitation on maximum lane count right?</p>



<a name="235428984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235428984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235428984">(Apr 20 2021 at 22:59)</a>:</h4>
<p>It will certainly be higher than 32 but also lower than usize::MAX I imagine</p>



<a name="235433192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235433192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235433192">(Apr 20 2021 at 23:44)</a>:</h4>
<p>Well, you can't make a <code>[u8; usize::MAX]</code> either, so it might be ok for simd to do the same kind of "yeah, no" errors that that makes.</p>



<a name="235434035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235434035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235434035">(Apr 20 2021 at 23:53)</a>:</h4>
<p>I don't think it's quite the same since <code>[u8; usize::MAX]</code> is a completely valid type, you just can't construct one.  The SIMD issue is a little more complicated because <code>SimdF32&lt;{ usize::MAX }&gt;</code> isn't even a valid type and errors the moment it's hit during typeck (or monomorphisation)</p>



<a name="235447209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235447209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235447209">(Apr 21 2021 at 03:04)</a>:</h4>
<p>well, lane counts I care about in practice are mostly:<br>
{ 2, 3, 4, 8, 16, 32, 48, 64, 80... 256 }</p>



<a name="235456865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235456865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235456865">(Apr 21 2021 at 05:15)</a>:</h4>
<p>Ooh, it was pointed out to me that I probably actually care about every even number up to 32! :D</p>



<a name="235457124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235457124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235457124">(Apr 21 2021 at 05:19)</a>:</h4>
<p>Yeah, I just mean that I don't know how important it is for it to fail at typeck.  I agree that <code>SimdF32&lt;{1 &lt;&lt; 20}&gt;</code> is not a type that's ever going to go well, but I also don't see it being materially worse than <code>[f32; 1&lt;&lt;20]</code> that also doesn't fail at typeck.</p>



<a name="235457168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235457168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235457168">(Apr 21 2021 at 05:19)</a>:</h4>
<p>It needs to fail at typeck because it needs to fail before layout calculation</p>



<a name="235457259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235457259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235457259">(Apr 21 2021 at 05:20)</a>:</h4>
<p>At a minimum it needs to fail before going to the backend in any form, though</p>



<a name="235457500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235457500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235457500">(Apr 21 2021 at 05:24)</a>:</h4>
<p>How is layout calculated for something that is supported, like <code>Simd&lt;96&gt;</code>?</p>



<a name="235457785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235457785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235457785">(Apr 21 2021 at 05:29)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/layout.rs#L667">https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/layout.rs#L667</a></p>



<a name="235457787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235457787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235457787">(Apr 21 2021 at 05:29)</a>:</h4>
<p>This match arm</p>



<a name="235459328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235459328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235459328">(Apr 21 2021 at 05:54)</a>:</h4>
<p>spicy.</p>



<a name="235460645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235460645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235460645">(Apr 21 2021 at 06:12)</a>:</h4>
<p>Ah, which eventually ends up here: <a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_target/abi/mod.rs.html#208-217">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_target/abi/mod.rs.html#208-217</a></p>
<p>That seems like it could hypothetically support arbitrary size, so <code>align_of::&lt;Simd&lt;f32, 100000&gt;&gt;</code> → 524288, even if you can never actually make an instance without things exploding...</p>



<a name="235460684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235460684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235460684">(Apr 21 2021 at 06:13)</a>:</h4>
<p>What happens when that would overflow?</p>



<a name="235460866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235460866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235460866">(Apr 21 2021 at 06:16)</a>:</h4>
<p>Might be fine to just do a <code>error[E0080]: values of the type ... are too big for the current architecture</code> like <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=ebaad7d8a951720088a9731d6da34037">this</a>.</p>



<a name="235461012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235461012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235461012">(Apr 21 2021 at 06:18)</a>:</h4>
<p>Oh, that even happens earlier than I'd expected -- <code>[u8; isize::MAX as usize / 2]</code> is no good either.</p>



<a name="235461290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235461290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235461290">(Apr 21 2021 at 06:22)</a>:</h4>
<p>Basically, if an already-stable <code>min_const_generics</code> array wrapper doesn't error for this in typeck, then I don't know that <code>Simd</code> really <em>needs</em> to either.</p>



<a name="235533763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/235533763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#235533763">(Apr 21 2021 at 15:42)</a>:</h4>
<p>speaking of, I would like to get all the SIMD stuff that isn't particular to the LLVM lowering out <code>rustc_codegen_llvm</code> and into <code>rustc_codegen_ssa</code></p>



<a name="236779343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/236779343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brandon Falk <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#236779343">(Apr 30 2021 at 03:11)</a>:</h4>
<p>Heya, I'm curious what's the limitation behind the <code>LanesAtMost32</code>? Is it related to the <code>[T; 0-32]</code> genericness of Rust?</p>



<a name="236779549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/236779549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#236779549">(Apr 30 2021 at 03:15)</a>:</h4>
<p>IIRC it has to do with LLVM barfing hard if you try to use the size-generic stuff for too large a size.</p>



<a name="236779690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/LanesAtMost32/near/236779690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/LanesAtMost32.html#236779690">(Apr 30 2021 at 03:17)</a>:</h4>
<p>Well, we had to pick an upper limit because we don't have a method of implementing all sizes yet. The upper limit in the compiler is 2^15 due to backend support.  We originally picked 64 because that supports 512 bit vectors of u8.  But we had to drop it down to 32 because the aarch64 optimizer crashes on 64 for some reason</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>